package com.samphanie.auiu.mbg.model;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.*;
import lombok.experimental.SuperBuilder;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

/**
 * @author ZSY
 * @email 1451691457@qq.com
 */
@Data
@With
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@TableName("auiu_users")
@EqualsAndHashCode(callSuper = true)
public class User extends BaseEntity implements Serializable {
    private static final long serialVersionUID = 2107524072483774717L;

    /*** 用户名 */
    private String username;
    private String realName;
    /*** 昵称 */
    private String nickname;
    /*** 手机号 */
    @JsonIgnore
    private String password;
    /*** 头像 */
    private String avatar;
    /*** 手机号 */
    private String mobile;
    /*** 邮箱 */
    private String email;

    private Integer gender;
    private Date birthday;
    private String source;

    private String city;

    /**
     * 备注信息
     */
    private String note;
    /**
     * 最后登录时间
     */
    private Date loginTime;
    /**
     * 最后登录IP
     */
    private String ip;

    private String registerIp;
    private String registerAddress;

    @TableField(exist = false)
    private Set<SysRole> roles;

    /**
     * 是否启用，默认启用
     */
    @Builder.Default
    private boolean enabled = true;
    /**
     * 账户是否未过期，默认未过期
     */
    @Builder.Default
    private boolean accountNonExpired = true;
    /**
     * 账户是否未锁定，默认未锁定
     */
    @Builder.Default
    private boolean accountNonLocked = true;
    /**
     * 密码是否未过期，默认未过期
     */
    @Builder.Default
    private boolean credentialsNonExpired = true;
    //    /*** 是否启用两步验证 */
    @Builder.Default
    private boolean usingMfa = false;
    /*** 两步验证的 key */
    @JsonIgnore
    private String mfaKey;
}
